<template>
  <el-row>
    <el-col :span="12">
      <div>{{ data.totalDeclareValue?data.totalDeclareValue.toFixed(2):data.totalDeclareValue }} {{ data.declareValueCurrency }}</div>
    </el-col>
    </br>
    <el-col :span="12">
      
      <span
        v-if="
          
            ((!verifyShow.saler && !verifyShow.saleAssistant &&  !verifyShow.seller && !verifyShow.shippingOperte) || verifyShow.superAdmin) &&
            serveCompanyMap
        " 
        >{{ serveCompanyMap[data.serviceCompanyId] }}</span
      >
    </el-col>
  </el-row>
</template>

<script>
import { ajax, actionPermission } from "@/store/yg/common/utils";
import axios from "axios";
import * as constant from "@/store/yg/common/constant";
import { m } from "@/store/yg/common/local";

export default {
  props: ["row", "data", "more"],
  data() {
    return {
      verifyShow: {
        //运单详情
        waybillView: true,
        //提单详情
        pickUpView: true,
        //发票
        invoiceView: true,
        //阿米巴
        amoebaView: true,
        //文件列表
        fileView: true,
        //应付应收
        payAndReceView: true,
        //应付
        payView: true,
        //应收
        receView: true,
        // 是否是跟单操作
        documentaryOperte: false,
        // ​是否是财务
        finace: false,
        // ​​是否是总部财务
        hqFinace: false,
        // ​​是否是HRA
        hra: false,
        // ​​其他
        other: false,
        // ​​是否是海外操作
        overseasOperte: false,
        // ​​是否是销售助理
        saleAssistant: false,
        // ​​是否是销售
        saler: false,
        // ​​是否是客服
        seller: false,
        // ​​是否是物流操作
        shippingOperte: false,
        // ​​是否是超级管理员
        superAdmin: false,
        // ​用户类型 一个用户有多种类型
        userTypes: []
      },
      serveCompanyMap: {}
    };
  },
  mounted() {
    this.permissionCheck();
  },
  methods: {
    permissionCheck() {
      var param = {};
      var userId = parseInt(this.$store.state.auth.user.id);
      console.log("userId", userId);
      var key = "permissions_init_" + userId;
      var permissions = JSON.parse(sessionStorage.getItem(key));
      
      var key1 = "serveCompanyMap_" + userId;
      this.serveCompanyMap = JSON.parse(sessionStorage.getItem(key1));
      if (
        !permissions ||
        permissions == "{}" ||
        null == permissions ||
        "null" == permissions
      ) {
        ajax("checkPermissionsServer", param).then(
          res => {
            this.verifyShow = res.data;
            sessionStorage.setItem(key, JSON.stringify(this.verifyShow));
            this.serveCompanyMap = res.data2;
            sessionStorage.setItem(key1, JSON.stringify(this.serveCompanyMap));
          },
          error => {
            console.log(error);
          }
        );
      }else{
        this.verifyShow = permissions;
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.padding-l-sm {
  padding-left: 2px;
}
</style>
